<?php
if (isset($_SESSION['user'])) {
    $url = URL_BASE;
    $cl = new Libs_Controller();
    $cl->redirect($url);
}
?>
<div class="products">
<div class="log-reg">
    <div class="products-title">
    <h3>Đăng nhập</h3>
    </div>
    <?php
//    if (isset($_COOKIE['user'])) {
        ?>
        <form name="logForm" action="<?php echo URL_BASE; ?>/customer/loginProcess" onsubmit="return validateLogForm();" method="post">
                <p>
                    <label>Địa chỉ Email:</label>
                    <input type="text" name="txtUser" id="username" class="inp" value="<?php echo $_COOKIE['user']; ?>" /><span class="mess" id="un-mess"></span>
                </p>
                <p>
                    <label>Mật khẩu:</label>
                    <input type="password" name="txtPass" id="password" class="inp" value="<?php echo $_COOKIE['pass']; ?>" /><span class="mess" id="pw-mess"></span>
                </p>
                <p>
                    <label></label>
                    <input type="checkbox" name="chkRemember" value="1" checked /> Nhớ mật khẩu
                </p>
                <p>
                    <label></label>
                    <input type="submit" name="btnSubmit" value="Đăng nhập" />
                </p>
        </form>
        <?php
//    } else {
        ?>
<!--        <form name="logForm" action="<?php echo URL_BASE; ?>/customer/loginProcess" onsubmit="return validateLogForm();" method="post">
                <p>
                    <label>Địa chỉ Email:</label>
                    <input type="text" name="txtUser" id="username" class="inp" /><span class="mess" id="un-mess"></span>
                </p>
                <p>
                    <label>Mật khẩu:</label>
                    <input type="password" name="txtPass" id="password" class="inp" /><span class="mess" id="pw-mess"></span>
                </p>
                <p>
                    <label></label>
                    <input type="checkbox" name="chkRemember" value="1" checked /> Nhớ mật khẩu
                </p>
                <p>
                    <label></label>
                    <input type="submit" name="btnSubmit" value="Đăng nhập" />
                </p>
        </form>-->
        <?php
//    }
    ?>
    <br />
    <a href="<?php echo URL_BASE; ?>/customer/register">Đăng ký</a> |<a href="forgot-password.php">Quên mật khẩu</a>
</div>
</div>